Llvm 22 upgrades and fixes#3821
Open
rchildre3 wants to merge 4 commits intoAFLplusplus:mainfrom
Open
Conversation
`PassPlugin.h` was moved from `Passes/` to `Plugins/` in LLVM commit: `f54df0d09e19 ([LLVM][NFC] Move PassPlugin from Passes to separate library, 2025-12-22)` (First tagged in LLVM 22 releases)
LLVM began introducing opaque pointers (pointer types with purposefully undefined pointee types) around LLVM 13[1] like in commit: `2155dc51d700 ([IR] Introduce the opaque pointer type, 2021-05-01)` introducing the function: `PointerType::get(LLVMContext &C, unsigned AddressSpace)` and had wholesale switched to only opaque pointers by LLVM 17[2]. Part of that effort deprecates many functions, including: `PointerType::get(Type *ElementType, unsigned AddressSpace)` though this function was depreacted much later in LLVM 21 in commit: `146ad71bc71a ([IR] Deprecate PointerType::get/getUnqual pointee type overload (#134517), 2025-04-07)` Switch libafl_cc's passes to the new function to avoid deprecation warnings [1]: https://releases.llvm.org/13.0.1/docs/ReleaseNotes.html#changes-to-the-llvm-ir [2]: https://releases.llvm.org/22.1.0/docs/OpaquePointers.html#version-support
Constructing an ArrayRef from a nullopt was deprecated in LLVM commit:
`2529de5c935a ([ADT] Deprecate ArrayRef(std::nullopt) (#146011), 2025-06-27)`
(First tagged in LLVM 21)
Then removed in LLVM commit:
`cfbb4cc31215 ([ADT] Remove ArrayRef(std::nullopt_t) (#165831), 2025-10-31)`
(First tagged in LLVM 22)
The LLVM authors recommend switching to the `{}` C++ syntax, so
introduce that conditional as a macro if and only if the LLVM version is
greater than or equal to 21 and fall back to the previous nullopt
workaround
`FATAL` is defined in the `common-llvm.h` and is therefore accessible to all of the passes, remove the duplicate in the pass `.cc` file to remove the compiler warning
2405609 to
b91ef19
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #3769
I see the comments from @tokatoka that:
#3769 (comment)
and:
#3777 (comment)
With concurrence from @domenukk :
#3777 (comment)
But as a stopgap here is a PR that gets everything compiling with no deprecation warnings with LLVM 22
Checklist
./scripts/precommit.shand addressed all comments